# requess模块处理cookie相关的请求
"""
1. 先在浏览器中登录网站

2. 从浏览器中复制过来登录之后的cookie信息

3. 将cookie字符串放到 headers字典中

4. 在发送请求的时候 带上headers
"""
# requests处理cookie的方法:1.cookie添加在heades中
import requests

url = "https://github.com/ZuoAndroid"

# 登录后从浏览器中复制User-Agent和Cookie
headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36",
    "Cookie": "_octo=GH1.1.1982342125.1590541963; _ga=GA1.2.646792670.1590541980; _device_id=521f5cc28583a375daea36bbfbdccfc6; tz=Asia%2FShanghai; _gat=1; has_recent_activity=1; user_session=PWh4kZAkUd_8HP7BELs6NeGAwVosghAaZDm_hIqvHLAJeWrX; __Host-user_session_same_site=PWh4kZAkUd_8HP7BELs6NeGAwVosghAaZDm_hIqvHLAJeWrX; logged_in=yes; dotcom_user=ZuoAndroid; _gh_sess=Hdd872tiPCkn6F5vKwuUTVckFCldI7DeRWxb6XPwoeTN6f7OoYXa1VJ3saks4P%2BPFZR5gLyNW6%2FIHm1xK5mBqOmkddxxUOt%2B7VPxmT5eEVP3u0nlW7OLCarOajle9fLIfKgAVhGtTeMLOTkfLo7UpVVORc4c0SkEoFIsmJKyySmEA1sv37arhb9WunoUEyGrqaKavChATsDtsCHJtrJdkLUgetLJtOdTHTbeGA8ZbviwXJOPhOHc438ePxoeKyxVP9uaWILZf0YThVSQydsxDNYFNUDLqj85JQi01%2FsBVMjkJjSbY2DgdL9qVslUn%2FcE8pzlRqIUD64NoUnOL7cZxU65SDzk%2BRb9sHNwYMSuuMFl2GwmBLrp5OSCg2BVmgSYuzu5Oflf7WrneipWVMWbu0IgWaUhfS6NUtCJZCFZ3tyW2g8Bj9m8pLxOrHwV6y72yx9lC5Dlg72c5ThdYJsHFM2706PMpqb7H9aw1rBRCWKNf4ouva1pKmzc5JyzFE02JrT6Fqg0ygF7%2FbCzEbo9hMaehS875p%2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bB%2Bbmr9JVfyhSw9l9SZEd3sSBPSf1w%2FIeMit%2Bly9qv13vx3X31%2FQrwourCPhwKgu3qF6l9gPMjdMFDzsZeWCdfH7%2BqhPELZZhl4GxtehjdfkUOVRyf4cIflM9YofzhOxkUfLII4U9aROlkcrLkvvbAVhyR5hxkvfxzx7YnDp%2FjyZHkWXofFuftTfYe6e3gbm63Ev3ZL8QwMnry9smUck1kIdSBBzrpRddVXGXQ0PmfPQ8tLsBiw3PLfSnVx3oSQgnBtl%2BAgxDn7jcPYIHO5ZTyFtX9o2ovDvBqUWY%2FOe%2BfZyqTo2mVjIbh8cVw5IHM--WRhx3t80WQgguo%2F5--EBcw6WTlvyCXA6yOGOP1kw%3D%3D"
}


response = requests.get(url, headers=headers)

print(response.content.decode())
